package com.sc.nft.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.extern.slf4j.Slf4j;
import com.sc.nft.entity.PledgeTaskCollection;
import com.sc.nft.mapper.PledgeTaskCollectionMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 质押任务-质押的NFT(sc_pledge_task_collection)数据DAO
 *
 * @author Sun
 * @since 2023-06-12 15:36:26
 * @description 由 Mybatisplus Code Generator 创建
 */
@Slf4j
@Repository
public class PledgeTaskCollectionDao extends ServiceImpl<PledgeTaskCollectionMapper, PledgeTaskCollection> {

    public List<PledgeTaskCollection> getListByPledgeTaskId(Long pledgeTaskId) {
        LambdaQueryWrapper<PledgeTaskCollection> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(PledgeTaskCollection::getPledgeTaskId, pledgeTaskId);
        return list(wrapper);
    }

    public PledgeTaskCollection getOneByPledgeTaskIdAndId(Long pledgeTaskId, Long pledgeTaskCollectionId) {
        LambdaQueryWrapper<PledgeTaskCollection> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(PledgeTaskCollection::getPledgeTaskId, pledgeTaskId);
        wrapper.eq(PledgeTaskCollection::getId, pledgeTaskCollectionId);
        return getOne(wrapper);
    }

    public PledgeTaskCollection getOneByPledgeTaskIdAndCollectionId(Long pledgeTaskId, Long collectionId) {
        LambdaQueryWrapper<PledgeTaskCollection> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(PledgeTaskCollection::getPledgeTaskId,pledgeTaskId);
        wrapper.eq(PledgeTaskCollection::getCollectionId,collectionId);
        return getOne(wrapper);
    }
}